
import * as mobx from 'mobx';
import * as API from '../../apis/addShare';

const { observable, action } = mobx;

export default class WfAddShareStore {

    @observable visible = false;
    @observable conditions = [];

    constructor(){

        this.getShareCondition = this.getShareCondition;
        this.setState = this.setState;
    }


    @action('修改数据')
    setState =  (obj,callback) =>  {
        const keys = Object.keys(obj);
        for(let key of keys){
            this[key] = obj[key];
        }

        typeof callback === 'function' && callback()
    }

    @action('获取配置conditions')
    getShareCondition = () =>  {
        API.getShareCondition().then(data => {
            this.conditions = data.conditions;
        })
    }

}